package com.lbd.commons;

import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang.time.DateFormatUtils;

import java.util.Date;

/**
 * Created by YajieWang on 2016/8/5.
 */
@Getter
@Setter
public class Result {
    ResultState state = ResultState.SUCCESS;
    String message;
    Object data;
    String timestamp = DateFormatUtils.format(new Date(), "yyyyMMddHHmmss");

    /**
     * 返回结果
     *
     * @param state   结果状态
     * @param message 描述
     * @param data    数据
     */
    public Result(ResultState state, String message, Object data) {
        this.state = state;
        this.message = message;
        this.data = data;
    }

    /**
     * 返回结果
     *
     * @param state   结果状态
     * @param message 描述
     */
    public Result(ResultState state, String message) {
        this.state = state;
        this.message = message;
    }

    /**
     * 返回结果
     *
     * @param data 数据
     */
    public Result(Object data) {
        this.state = ResultState.SUCCESS;
        this.data = data;
    }


}
